<?php
/**
 * Created by PhpStorm.
 * User: 庆金
 * Date: 2019-12-21
 * Time: 22:15
 * 使用场景：多进程 数据共享
 */
// 创建内存表
$table = new swoole_table(1024);

//内存增加一列
$table->column("id",$table::TYPE_INT, 4);
$table->column("name",$table::TYPE_STRING,64);
$table->column("age",$table::TYPE_INT,3);
$table->create();

$table->set('singwa_imooc',['id'=>1,'name'=>'singwa','age'=>26]);

//另外一种赋值方案
$table['arr2'] = ['id'=>2,'name'=>'singwa2','age'=>36];

//进行加操作
$table->incr("arr2",'age',2);

//减操作
$table->decr("arr2",'age',2);

//$arr = $table->get('arr2');


$arr = $table['arr2'];
print_r($arr);

//删除操作
$table->del("arr2");
print_r($table['arr2']);

//是否存在
echo $table->exist("arr2").PHP_EOL;
echo $table->exist("singwa_imooc").PHP_EOL;
